{{- $imageUrl := false }}
{{- range $match := (findRESubmatch `(?i)<img[^>]+src=["']([^"']+)["']` .Content)}}
  {{- $foundUrl := index $match 1 }}
  {{- if and $foundUrl (not (or (strings.HasPrefix $foundUrl "http://") (strings.HasPrefix $foundUrl "https://"))) }}
    {{- $imageUrl = $foundUrl }}
    {{- break }}
  {{- end }}
{{- end }}
{{- if $imageUrl }}
{{- (.Resources.GetMatch $imageUrl).RelPermalink }}
{{- end }}